//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _PLAYERWINDOW_H
#define _PLAYERWINDOW_H
//
#include <osg/Group>
#include <osg/Geode>
#include <qwidget.h>
#include <player/controller_fwd.h>
#include <model/root_fwd.h>
//
class OSGViewerWidget;
class PlayerWindow:public QWidget
{
   Q_OBJECT
   Q_PROPERTY(bool hasModel READ has_model DESIGNABLE false STORED false)
   Q_PROPERTY(bool isPlaying READ is_playing WRITE set_playing DESIGNABLE false STORED false)
   Q_PROPERTY(double currentTime READ get_current_time DESIGNABLE false STORED false)
   Q_PROPERTY(bool gravitationEnabled READ get_gravitation_enabled WRITE set_gravitation_enabled)
   Q_PROPERTY(bool frictionEnabled READ get_friction_enabled WRITE set_friction_enabled)
//construction
public:
   PlayerWindow(QWidget* parent=0,Qt::WindowFlags flags=0);
   virtual ~PlayerWindow();
//slots
public slots:
   void set_playing(bool playing);
   void set_current_time(double time);
   void set_gravitation_enabled(bool enabled);
   void set_friction_enabled(bool enabled);
//state
public:
   void set_model(model::Root* model);
   bool has_model() const;
   bool is_playing() const;
   double get_current_time() const;
   bool get_gravitation_enabled() const;
   bool get_friction_enabled() const;
//data
protected:
   bool playing;
   OSGViewerWidget* viewer;
   osg::ref_ptr<osg::Group> scene_root;
   osg::ref_ptr<osg::Group> scene_background;
   osg::ref_ptr<player::Controller> controller;
   osg::ref_ptr<osg::Geode> particle_geode;
};
//
#endif